var webPath = "";
$(document).ready(function(){
	webPath = $("#webPath").val();
	var msg = $("#message").val();
	if(msg != ""){
		alert(msg);
	}
	
	$("input[name='menuBean.menuShow']").bind("click",function(){
		if($(this).val() == "1"){
			$("#menuOrder").parent().append('<span class="font_red">*</span>');
			$("#menuPath").parent().append('<span class="font_red">*</span>');
		}else{
			$("#menuOrder").next("span").remove();
			$("#menuPath").next("span").remove();
		}
	});
});

function submitType(){
	if(string.trim($("#typeName").val()) == ""){
		alert("请输入信息栏目名称！");
		$("#typeName").select();
		return false;
	}
	var item = $("input[name='menuBean.menuShow']:checked").val(); 
	if(item == "1"){
		if(string.trim($("#menuOrder").val()) == ""){
			alert("请输入导航菜单序号！");
			$("#menuOrder").select();
			return false;
		}
		if(string.trim($("#menuPath").val()) == ""){
			alert("请输入导航菜单路径！");
			$("#menuPath").select();
			return false;
		}
	}
	var method = $("#method").val();
	if(method == ""){
		method = "create";
	}
	document.form1.action = webPath + "/admin/mtype!"+method+".action";
	document.form1.submit();
}

function delType(menuId){
	if(menuId == ""){
		alert("请选择信息栏目！")
		return false;
	}
	var question = confirm("确定删除吗？");
	if(question){
		$("#menuId").val(menuId);
		document.form1.action = webPath + "/admin/mtype!del.action";
		document.form1.submit();
	}
}

function initUpdate(menuId){
	if(menuId == ""){
		alert("请选择信息栏目！")
		return false;
	}
	$("#menuId").val(menuId);
	document.form1.action = webPath + "/admin/mtype!initUpdate.action";
	document.form1.submit();
}

function changeParent(parentMenu){
	$("#parentMenu").val(parentMenu);
	document.form1.action = webPath + "/admin/mtype!query.action";
	document.form1.submit();
}